GBML manual / Constants

EASE_BOUNCE_IN_OUT

Bounces away from the start, crosses the middle, then bounces into the end. Never goes outside the range from the start to the end.

Syntax

EASE_BOUNCE_IN_OUT: constant

Description

The "bounce in out" curve for tween and tween_to: it bounces away from the start and then bounces into the end. After a quarter of the time it is at 0.12, after half exactly 0.50, and after three quarters at 0.88.

It never goes outside the range

Unlike back and elastic, a bounce never goes outside the range from from to to. The first half is the hops of EASE_BOUNCE_IN squeezed into half the time, the second half is the bounces of EASE_BOUNCE_OUT, and the whole thing stays between the two numbers, so it is safe to use on a number with limits.

It lands exactly on to and stays there: after the end the number is exactly to, every frame.

A real capture, 27 frames played in a loop - three small graphs, one above the other, labeled in, out and in out. In each one a ball moves steadily to the right while its height on the screen is the number being tweened: a dim dashed line at the top is where the number starts, a green dashed line below it is where it ends, and a trail of dots shows where the ball has been. In the out row the ball drops to the green line like a dropped ball and bounces back up three times, each bounce smaller than the last, before it rests on the line. The in row is the same thing the other way round: small hops off the dim line that get taller, and then a drop to the green line. The in out row bounces away from the start and then into the end. No ball ever goes below the green line or above the dim one. The first frame, which is all a viewer that cannot animate shows, is the finished picture: every dot, drawing the whole of each curve.A real capture, 27 frames played in a loop - three small graphs, one above the other, labeled in, out and in out. In each one a ball moves steadily to the right while its height on the screen is the number being tweened: a dim dashed line at the top is where the number starts, a green dashed line below it is where it ends, and a trail of dots shows where the ball has been. In the out row the ball drops to the green line like a dropped ball and bounces back up three times, each bounce smaller than the last, before it rests on the line. The in row is the same thing the other way round: small hops off the dim line that get taller, and then a drop to the green line. The in out row bounces away from the start and then into the end. No ball ever goes below the green line or above the dim one. The first frame, which is all a viewer that cannot animate shows, is the finished picture: every dot, drawing the whole of each curve.
A real capture, 27 frames played in a loop - three small graphs, one above the other, labeled in, out and in out. In each one a ball moves steadily to the right while its height on the screen is the number being tweened: a dim dashed line at the top is where the number starts, a green dashed line below it is where it ends, and a trail of dots shows where the ball has been. In the out row the ball drops to the green line like a dropped ball and bounces back up three times, each bounce smaller than the last, before it rests on the line. The in row is the same thing the other way round: small hops off the dim line that get taller, and then a drop to the green line. The in out row bounces away from the start and then into the end. No ball ever goes below the green line or above the dim one. The first frame, which is all a viewer that cannot animate shows, is the finished picture: every dot, drawing the whole of each curve.

The same tween three ways, one row for each of EASE_BOUNCE_IN, EASE_BOUNCE_OUT and EASE_BOUNCE_IN_OUT. The ball's height is the number (like tween_to(y, ...) moving something down), and it drifts right at a steady speed only so that the shape can be seen. The dim line is where the number starts and the green line is where it ends: the ball touches the green line but never goes below it. Real pictures from a Game Boy Advance ROM, 4 frames apart, played at the speed of the console. A viewer that does not animate shows the first picture, the finished one.

Example

tween_to(y, y + 80, 80, EASE_BOUNCE_IN_OUT);

y grows downward, so the walker makes a few small hops off its place, crosses the middle, then drops onto a spot 80 pixels lower and bounces to rest there.

Busy, and best kept for something playful: a bouncy transition between two places, a character that hops from one spot to another.

See also: tweentween_totween_from_to